package org.example.order.service;

import org.example.order.domain.Order;
import org.example.order.domain.OrderDomainService;
import org.example.order.domain.OrderRepository;
import org.example.order.service.converter.OrderConverter;
import org.example.order.service.dto.OrderDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderService {
    private OrderDomainService orderDomainService;

    public OrderService(@Autowired OrderRepository orderRepository) {
        this.orderDomainService = new OrderDomainService(orderRepository);
    }

    public OrderDTO getOrder(String orderId) {
        Order order = orderDomainService.getOrder(orderId);
        return OrderConverter.INSTANCE.convert(order);
    }
}
